import java.util.Properties;

import javax.naming.InitialContext;

/**
 * 
 * @author Bua_Pietro
 * 
 */
public class ActionHouse {

	static final String IIOP_STRING = "com.sun.jndi.cosnaming.CNCtxFactory";
	static final String IIOP_URL_STRING = "iiop://localhost:9000";

	public static void main(String args[]) {
		try {

			PriceListImpl priceList = new PriceListImpl();
			OrderImpl ordersList = new OrderImpl();
			priceList.addPrice("Nutella", "3.50");
			priceList.addPrice("Pindakaas", "4.99");
			priceList.addPrice("Ciao", "0.00");
			priceList.addPrice("Computer", "103.50");
			priceList.addPrice("PC", "13.37");
			priceList.addPrice("Laptop", "234.56");
			priceList.addPrice("Diablo", "402.50");

			// Create the IIOP Initial Context
			Properties iiopProperties = new Properties();
			iiopProperties.put("java.naming.factory.initial",
					ActionHouse.IIOP_STRING);
			iiopProperties.put("java.naming.provider.url",
					ActionHouse.IIOP_URL_STRING);
			InitialContext iiopContext = new InitialContext(iiopProperties);

			iiopContext.rebind("pricelist", priceList);
			iiopContext.rebind("orderlist", ordersList);

			System.out.println("Server is started @ "
					+ ActionHouse.IIOP_URL_STRING);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
